Crate puffin[][src]

Expand description

Usage:

fn main() {
    puffin::set_scopes_on(true); // you may want to control this with a flag

    // game loop
    loop {
        puffin::GlobalProfiler::lock().new_frame();

        {
            puffin::profile_scope!("slow_code");
            slow_code();
        }

    }
}

Macros

current_file_name

Returns a shortened path to the current file.

current_function_name

Returns the name of the calling function without a long module path prefix.

profile_function

Automatically name the profiling scope based on function name.

profile_function_dataDeprecated
profile_scope

Profile the current scope with the given name (unique in the parent scope).

profile_scope_dataDeprecated

Structs

FrameData

One frame worth of profile data, collected from many sources.

GlobalProfiler

Singleton. Collects profiling data from multiple threads.

MergePiece
MergeScope

An record of several sibling (or cousin) scopes.

ProfilerScope

Created by the puffin::profile*!(...) macros.

Reader

Parses a Stream of profiler data.

Record

Used when parsing a Stream.

Scope

Used when parsing a Stream.

Stream

Stream of profiling events from one thread.

ThreadInfo

Used to identify one source of profiling data.

ThreadProfiler

Collects profiling data for one thread

Enums

Error

Errors that can happen when parsing a Stream of profile data.

Functions

are_scopes_on

Are the profiler scope macros turned on? This is false by default.

global_reporter

Report a stream of profile data from a thread to the GlobalProfiler singleton.

merge_children_of_pieces

Merge sibling scopes with the same id.

merge_top_scopes

Merge sibling scopes with the same id.

now_ns

Returns monotonically increasing nanosecond count. It is undefined when now_ns()=0 is.

set_scopes_on

Turn on/off the profiler macros (profile_function, profile_scope etc). When off, these calls take only 1-2 ns to call (100x faster). This is false by default.

Type Definitions

FrameIndex
NanoSecond

All times are expressed as integer nanoseconds since some event.

Result